package com.zzptc.sky.bdsjws.fragments.base;

import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import com.zzptc.sky.bdsjws.MyApplication;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/4/20.
 */

public abstract class BaseFragment extends DialogFragment {
    protected View v;
    Unbinder unbinder;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //v=View.inflate(MyApplication.getContext(),getContentXml(),null);
        v=inflater.inflate(getContentXml(),container,false);
        unbinder= ButterKnife.bind(this,v);
        initDataView(v);
        return v;
    }
public abstract void initDataView(View v);
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog=super.onCreateDialog(savedInstanceState);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        return dialog;
    }

    public abstract int getContentXml();

    @Override
    public void onDestroy() {
        super.onDestroy();
        if(unbinder!=null){
            unbinder.unbind();
        }
    }
}
